package com.quwan.common.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lt
 * @Date 2021/12/1 11:58 上午
 */
public class OssConstant {

    public static final String PUBLIC_IMG = "public";
    public static final String USER_IMG = "user";
    public static final String INFO_IMG = "info";
    public static final String HELP_FEEDBACK = "helpFeedback";
    public static final String DEFAULT = "default";
    public static final String VIDEO = "video";
    public static final String IMAGE = "image";
    private static final Map<String, String> ossPath = new HashMap(12);
    static {
        ossPath.put(PUBLIC_IMG, "image/public/"); //公共的图片
        ossPath.put(USER_IMG, "image/user/"); //用户相关的，头像，证件照
        ossPath.put(INFO_IMG, "image/info/"); //资讯图片
        ossPath.put(HELP_FEEDBACK, "image/helpFeedback/"); // 帮助信息的图片
        ossPath.put(VIDEO, "video/"); // 帮助信息的图片
        ossPath.put(DEFAULT, "default/");// 默认路径
        ossPath.put(IMAGE, "image/");// 默认路径
    }

    /**
     * 根据type获取文件路径
     *
     * @param type
     * @return
     */
    public static String getFilePath(String type) {
        String filePath = ossPath.get(type);
        if (null == filePath) {
            filePath = ossPath.get(DEFAULT);
        }
        return filePath;
    }

}
